import {getEtagHeaderAndData,setEtagHeaderAndData} from '@njt/foundation/helper/dropdownlist'

// 贴标工单状态
export const labelWorkOrderStateDropdownList = [
  { label: '初始', value: '0' },
  { label: '计划移库', value: '1' },
  { label: '完成移库', value: '3' },
  { label: '已上线', value: '5' },
  { label: '已下线', value: '7' },
  { label: '已QA', value: '9' },
]

export function getBillingNameSimpleList() {
  const api = '/project/mhlbc/bill/billing/billing-name-list'
  const localCache = getEtagHeaderAndData(api)
  return $f.axios.get<string[]>(api, {headers: localCache.headers})
    .then(result => {
      setEtagHeaderAndData(api, result)
      return result.data
    }).catch(err => {
      if (err?.response?.status === 304) {
        return JSON.parse(localCache.data!) as string[]
      }
      throw err
    })
}
